if os.path.isfile(file_pyo) and os.stat(file_pyo).st_mtime >= os.stat(file_py).st_mtime:
fname = file_pyo
elif not os.path.isfile(file_pyc) or os.stat(file_pyc).st_mtime < os.stat(file_py).st_mtime:
import py_compile as py_compile
if self.debug:
print 'Compiling', file_py
try:
py_compile.compile(file_py, file_pyc, None, True)
except py_compile.PyCompileError:
err = None
print err.msg
fname = file_pyc
else:
fname = file_pyc
archivename = os.path.split(fname)[1]
if basename:
archivename = '%s/%s' % (basename, archivename)
return (fname, archivename)
def main(args = None):
import textwrap as textwrap
USAGE = textwrap.dedent(' Usage:\n zipfile.py -l zipfile.zip # Show listing of a zipfile\n zipfile.py -t zipfile.zip # Test if a zipfile is valid\n zipfile.py -e zipfile.zip target # Extract zipfile into target dir\n zipfile.py -c zipfile.zip src ... # Create zipfile from sources\n ')
if args is None:
args = sys.argv[1:]
if not args or args[0] not in ('-l', '-c', '-e', '-t'):